<style scoped>
.r-view {
  padding: 0 16px;
  background-color: #409eff;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  cursor: pointer;
  color: #ffffff;
}
</style>
<!--  -->
<template>
  <a href="javascript: void(0);" @click="viewDefaultDomain">
    <div class="r-view">浏&nbsp;览</div>
  </a>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState([
      'site'
    ])
  },
  data () {
    return {
    }
  },
  methods: {
    viewDefaultDomain () {
      const loading = this.$loading({
        lock: true,
        text: '正在打开...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      this.$post('/url/site-link').then(response => {
        loading.close()
        if (response) {
          window.open(response, '_blank')
        }
      }, () => {
        loading.close()
      })
    }
  }
}

</script>
